package com.ymttest.database.sqlwapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.CSLocalReturnImage;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : CSLocalReturnImageWapper.java
 * @Author : sunsheng
 * @Date : 2015年8月14日
 * @Copyright : 洋码头
 ************************************************************************************/
public class CSLocalReturnImageWapper {

	SqlManager manage;

	public CSLocalReturnImageWapper() {
		manage = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	/**
	 * 获取对应returnId 图片url
	 * 
	 * @param returnId
	 * @return 图片url,如果没有返回null
	 * @throws InterruptedException
	 */
	public String getImgurl(String returnId) throws InterruptedException {
		String imgurl = null;
		Map<String, String> map = new HashMap<String, String>();
		map.put("returnid", returnId);
		Thread.sleep(1000);
		List<CSLocalReturnImage> localReturnImage = manage.getSelectResults(
				"com.ymttest.database.mapping.CSLocalReturnImageMapper.selectLiveActivity", map);
		if (localReturnImage.size() > 0) {
			imgurl = localReturnImage.get(0).getImgurl();
		}
		// manage.close();
		return imgurl;
	}

	public static void main(String[] args) {
		try {
			Logger.debug(new CSLocalReturnImageWapper().getImgurl("181b8121-2b83-4ee7-b257-6cf8f96d36bf"));
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

	}

}
